﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Web;

namespace Finance.Web.Models.Mapping
{
    public class PercentAmountDependMap : EntityTypeConfiguration<PercentAmountDepend>
    {
        public PercentAmountDependMap()
        {
            this.HasKey(t => t.Code);

            this.ToTable("PERCENTAMOUNTDEPEND");
            this.Property(t => t.Code).HasColumnName("PADEPCODE");
            this.Property(t => t.DepCode).HasColumnName("DEPCODE");
            this.Property(t => t.MinAmount).HasColumnName("MINAMOUNT");
            this.Property(t => t.MaxAmount).HasColumnName("MAXAMOUNT");
            this.Property(t => t.Percent).HasColumnName("PERCENT");

            // Relationships
            this.HasOptional(t => t.Deposit)
                .WithMany(t => t.PercentAmountDepends)
                .HasForeignKey(d => d.DepCode);

        }
    }
}